import axios from "axios";
import {message} from "antd";

const goodsRequest = axios.create({
    baseURL: '/good'
});
goodsRequest.interceptors.request.use((config:any) => {
    config.headers.token = 'eyJhbGciOiJIUzUxMiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAAKtWKi5NUrJSSkzJzcxT0lFKrShQsjI0M7M0NDY0NjWpBQAezRFzIAAAAA.LCVqDYGDUfpz-Hfqc0PlZoeBmjpawCdHNLEQ-hC7CoGdkjhgJjkrd8B62fVRbQfqXOdzVLgQuTJEPBE9pLzm3g';
    return config;
})
goodsRequest.interceptors.response.use(({data}) => {
    if (data.code === 200) {
        return data;
    }
    message.error(data.message);
    return Promise.reject(data);
})
export default  goodsRequest;
